home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
-
- /**
- @Tool: demote~creates a parent - children relationship that can be opened and
- closed. To use select two or more lines and then run this script. The first line
- selected will become the parent and the remaining lines become
- the children of the parent. If the control key is held down while running this
- script the child lines will be folded.
- @EndTool:
- @Summary: demote~creates a range of lines that can be folded
- */
-
- function DoCommand()
- {
- var editor = getActiveEditor();
- if (editor)
- {
- var lines = editor.getLines();
- var selection = editor.GetSelection();
- var startLine = selection.startLineIndex;
- var endLine = selection.endLineIndex;
- if (selection.endCharIndex == 0)
- {
- endLine -= 1; // do not include the next line
- }
- var lineCount = endLine - startLine;
- if (lineCount >= 2)
- {
- lines.demoteLines(startLine, endLine, isKeyDown("Control"));
- }
- lines.update("Demote Lines");
- }
- }
-
- !!/Script
-
-